Matthias Clasen [Tue, 13 Oct 2020 04:49:10 +0000 (00:49 -0400)]
text: Make editable signals work again
Since the big editable reorg, GtkText was not emitting
::insert-text and ::delete-text, as is expected of
editables. We want to use those signals for a11y
change notification, so make them work again.
Matthias Clasen [Tue, 13 Oct 2020 03:20:58 +0000 (23:20 -0400)]
atspi: Set placeholder-text attribute
This is how GTK3 passes placeholder-text to orca,
and it works - orca reads it.
Matthias Clasen [Tue, 13 Oct 2020 02:07:18 +0000 (22:07 -0400)]
atspi: Implement EditableText interface for the entry wrappers
Drop the EditableText implementation for GtkText,
and implement it for all the wrapper widgets instead.
Matthias Clasen [Tue, 13 Oct 2020 01:55:25 +0000 (21:55 -0400)]
accessible: Add some docs
Explain briefly how a11y works for entry wrappers
(since I won't remember a few months from now).
Matthias Clasen [Tue, 13 Oct 2020 01:18:53 +0000 (21:18 -0400)]
atspi: Implement Text interface for the entry wrappers
Drop the Text implementation for GtkText, and implement
it for all the wrapper widgets instead.
Matthias Clasen [Tue, 13 Oct 2020 01:34:16 +0000 (21:34 -0400)]
spinbutton: Implement GtkAccessible
This copies what was done for GtkEntry: get
the focused state from the GtkText within.
We also add a private getter for the text widget,
which was missing here.
Matthias Clasen [Tue, 13 Oct 2020 01:33:55 +0000 (21:33 -0400)]
passwordentry: Implement GtkAccessible
This copies what was done for GtkEntry: get
the focused state from the GtkText within.
Matthias Clasen [Tue, 13 Oct 2020 01:17:31 +0000 (21:17 -0400)]
searchentry: Implement GtkAccessible
This copies what was done for GtkEntry: get
the focused state from the GtkText within.
Matthias Clasen [Tue, 13 Oct 2020 00:18:48 +0000 (20:18 -0400)]
entry: Implement GtkAccessible
Override the get_platform_state vfunc to get
the focused state from the GtkText widget within.
Matthias Clasen [Tue, 13 Oct 2020 00:19:29 +0000 (20:19 -0400)]
text: Ignore text widgets for a11y
We want to implement the Text interface on the
wrapper entries.
Matthias Clasen [Mon, 12 Oct 2020 23:01:57 +0000 (19:01 -0400)]
atspi: Use gtk_accessible_get_platform_state
Matthias Clasen [Mon, 12 Oct 2020 23:00:03 +0000 (19:00 -0400)]
accessible: Add gtk_accessible_get_platform_state
As a companion to go with the platform_change api,
add a gtk_accessible_get_platform_state() function
that can be used by backends to get the platform
state.
This is in preparation for making entries inherit
their focus states from the text widget within.
Matthias Clasen [Mon, 12 Oct 2020 20:39:35 +0000 (16:39 -0400)]
atspi: Use gtk_accessible_should_present
Replace explicit visibility check by this
more general method of determining whether
an accessible should be presented to the
a11y layer.
Matthias Clasen [Mon, 12 Oct 2020 20:22:52 +0000 (16:22 -0400)]
accessible: Add a way to hide accessibles
Similar to gtk_widget_should_layout(), add a
gtk_accessible_should_present() function that backends can
use to determine whether an accessible should be presented
or not.
Ways to make a widget not presented in a11y:
- hide the widget
- set its role to NONE
- make it have a NULL AT context
We will use this in future to hide the GtkText inside
an entry, since the Text implementation will be done
by the wrapper.
Matthias Clasen [Mon, 12 Oct 2020 20:12:14 +0000 (16:12 -0400)]
Cosmetics
Matthias Clasen [Tue, 13 Oct 2020 01:32:37 +0000 (21:32 -0400)]
atspi: Treat all entries the same for collecting state
We are determining editable state based on the
accessible role (although we could make it platform
state now), so cover all the roles that we use for
entry wrappers.
Matthias Clasen [Tue, 13 Oct 2020 01:16:03 +0000 (21:16 -0400)]
atspi: Fix collecting states
This is somewhat embarrassing.
Matthias Clasen [Mon, 12 Oct 2020 20:40:34 +0000 (16:40 -0400)]
Fix the build
Matthias Clasen [Mon, 12 Oct 2020 19:50:36 +0000 (15:50 -0400)]
atspi: D-Bus methods return tuples
I've learned this the hard way: When returning a
value from a D-Bus call, the variant construct must
*always* be g_variant_new ("(...)"...
Matthias Clasen [Mon, 12 Oct 2020 19:04:50 +0000 (15:04 -0400)]
Don't unref a floating variant
It gets consumed somewhere along the way.
Matthias Clasen [Mon, 12 Oct 2020 18:41:38 +0000 (14:41 -0400)]
atspi: Unregister objects on the bus
When a widget is going away, we need to remove
the context from the bus, or else ATs might have
the idea to call methods on them, leading to badness.
Matthias Clasen [Mon, 12 Oct 2020 18:11:30 +0000 (14:11 -0400)]
atspi: Emit property changes for focus
With this orca, actually speaks \o/. Sadly, it only
says 'gtk modelbutton widget' so far, but its a start.
Matthias Clasen [Mon, 12 Oct 2020 17:15:05 +0000 (13:15 -0400)]
atspi: Cosmetics
Use simple wrappers instead of opencoding bit twiddling
all over the place.
Matthias Clasen [Mon, 12 Oct 2020 17:13:00 +0000 (13:13 -0400)]
widget: Notify a11y of focus changes
This is using the new 'platform changes' mechanism
to tell the a11y backends when focus changes.
Matthias Clasen [Mon, 12 Oct 2020 17:05:43 +0000 (13:05 -0400)]
a11y: Pass on platform changes
Add an enum for 'platform changes' to the at context
change notification mechanism. This will let us pass
along things that ARIA considers 'platform state' such
as focus or editability. The difference between the
platform state and other ARIA states is that we don't
keep the platform state separately in the at context
- backends are expected to just query the widgets.
This is just about avoiding notify listeners for
change notification.
Matthias Clasen [Mon, 12 Oct 2020 13:50:57 +0000 (09:50 -0400)]
atspi: Be more careful about indexes
Don't return a number for IndexInParent when we
don't have one.
Matthias Clasen [Mon, 12 Oct 2020 04:21:14 +0000 (00:21 -0400)]
atspi: Set some more atspi states
Pass on more of the states that are represented
as properties in aria: modal, multi-line, orientation.
Matthias Clasen [Mon, 12 Oct 2020 04:19:55 +0000 (00:19 -0400)]
Pass orientation property to accessible
We should set the accessible properties we have,
where they make sense. So set orientation, if the
widget is orientable.
Matthias Clasen [Mon, 12 Oct 2020 00:22:06 +0000 (20:22 -0400)]
wip: Emit StateChanged signals
This is not fully baked, but it is enough to make accerciser
notice when a text entry goes from editable to not editable.
Matthias Clasen [Mon, 12 Oct 2020 03:35:34 +0000 (23:35 -0400)]
atspi: Derive readonly state from aria properties
We can use the read-only property, together with the
accessible role, to determine whether to set editable
and read-only states for at-spi. This lets us avoid
directly poking at the widgets.
Matthias Clasen [Mon, 12 Oct 2020 03:34:36 +0000 (23:34 -0400)]
text: Set the readonly accessible property
This mirrors what we already do for GtkTextView.
Matthias Clasen [Sun, 11 Oct 2020 22:59:22 +0000 (18:59 -0400)]
atspi: Set editable state
ATs look at not just the implemented interfaces, but
also the states to decide what to do. It turns out that
the EditableText interface is only used by accerciser
if the editable state is set. So set it.
Matthias Clasen [Sun, 11 Oct 2020 20:39:26 +0000 (16:39 -0400)]
atspi: Implement EditableText interface
Implement EditableText for GtkText and GtkTextView.
Matthias Clasen [Sun, 11 Oct 2020 20:18:56 +0000 (16:18 -0400)]
atspi: Break out the Value implementation
This isn't necessarily very big, but it keeps
the widget checks out of gtkatspicontext.c, and
it is a nice pattern.
Matthias Clasen [Sun, 11 Oct 2020 20:03:19 +0000 (16:03 -0400)]
atspi: Break out the Text implementations
Move the implementation of the Text interface
to its own source file, and split it up along
widget lines, to avoid it becoming too messy.
Matthias Clasen [Sun, 11 Oct 2020 15:46:06 +0000 (11:46 -0400)]
scalebutton: Set accessible value properties
This is what we did in GTK 3.
Matthias Clasen [Sun, 11 Oct 2020 15:30:54 +0000 (11:30 -0400)]
paned: Set accessible value properties
This is what we did in GTK 3.
Matthias Clasen [Sun, 11 Oct 2020 15:06:29 +0000 (11:06 -0400)]
Simplify GetInterfaces handling
It is error prone to keep the same conditions in sync
in two places. Instead, just assemble the list of interfaces
as we register objects, and use when GetInterfaces is called.
Matthias Clasen [Sun, 11 Oct 2020 14:33:05 +0000 (10:33 -0400)]
atspi: Implement Value for more widgets
Apply the Value implementation to the widgets where
we had one in GTK 3: GtkLevelBar, GtkRange, GtkScaleButton,
GtkSpinButton, GtkPaned, GtkProgressBar. To make these
work, the widgets need to set the accessible value properties.
Matthias Clasen [Sun, 11 Oct 2020 04:27:55 +0000 (00:27 -0400)]
atspi: Implement Value interface for ranges
Matthias Clasen [Sun, 11 Oct 2020 03:48:49 +0000 (23:48 -0400)]
atspi: Implement Text interface for text views
With this, all relevant widgets support the
Text interface.
Matthias Clasen [Sun, 11 Oct 2020 03:47:34 +0000 (23:47 -0400)]
atspi: Add textview utilities
These are very similar to the pango utilities,
and are copying code from the textview accessible
implementation in GTK 3.
Matthias Clasen [Sun, 11 Oct 2020 03:50:02 +0000 (23:50 -0400)]
atspi: Export more pango utils
We are going to reuse some of the code that does
the pango -> atspi attribute conversion for text
tags.
Matthias Clasen [Sun, 11 Oct 2020 00:38:24 +0000 (20:38 -0400)]
atspi: Implement text for GtkText widgets too
There is some open question here whether the interface
should be implemented on the outer or the inner widget
of the entry-text pairs. For now, our hand is forced,
since only GtkText provides access to the layout that
we need for implementing many of the interface methods.
Matthias Clasen [Sat, 10 Oct 2020 03:35:00 +0000 (23:35 -0400)]
atspi: Implement Text interface for labels
This is a not-quite-complete implementation of the
Text interface for GtkLabel. The missing parts are
anything around extents and positions, as well as
the ScrollSubstring apis.
Matthias Clasen [Sat, 10 Oct 2020 17:42:07 +0000 (13:42 -0400)]
atspi: Add pango utilities
This code is more or less a direct copy of what
we had in gtkpango.c in 3.x.
Matthias Clasen [Sat, 10 Oct 2020 16:22:16 +0000 (12:22 -0400)]
atspicontext: Fix GetIndexInParent for toplevels
For toplevels, we need to return the index in the
list of toplevels, since that is what GtkAtspiRoot
is using.
Matthias Clasen [Sat, 10 Oct 2020 16:12:03 +0000 (12:12 -0400)]
atcontext: labelled-by has a reference list
This is unclear - our docs state that all the
relations have value type reference, but in fact
they all have value type reference list.
Matthias Clasen [Sat, 10 Oct 2020 14:43:59 +0000 (10:43 -0400)]
atspicontext: Implement GetRelationSet
This translates relations as far as the match.
I'm not sure yet what we can do about the fact that
atspi expects relations to be bidirectional (ie have
label-for *and* labelled-by) while aria has only one
direction.
Matthias Clasen [Sat, 10 Oct 2020 14:43:07 +0000 (10:43 -0400)]
atspiroot: Stub out GetRelationSet
This needs to be fully implemented, for now sending
an empty relation set back prevents accerciser from
getting hung up.
Matthias Clasen [Sat, 10 Oct 2020 16:24:25 +0000 (12:24 -0400)]
atspi: Add the AtspiRelationType enum
This is what we need to map the aria relation
types to.
Matthias Clasen [Sat, 10 Oct 2020 15:16:47 +0000 (11:16 -0400)]
Move atspi enums to gtkatspiprivate.h
Matthias Clasen [Sat, 10 Oct 2020 03:32:36 +0000 (23:32 -0400)]
Add a GetInterfaces method
It turns out that accerciser depends on this undocumented
method that is not in the xml at all, otherwise interface
sections in the accerciser ui never get enabled.
Matthias Clasen [Sat, 10 Oct 2020 14:06:50 +0000 (10:06 -0400)]
Don't pass NULL to g_variant_new_string
That does not work.
Matthias Clasen [Sat, 10 Oct 2020 13:23:49 +0000 (09:23 -0400)]
atspi utils: Fix an oversight
gtk_accessible_role_to_atspi_role must always return
an atspi role. The fallback was returning an aria
role.
Matthias Clasen [Sat, 10 Oct 2020 17:43:48 +0000 (13:43 -0400)]
Fixup: Add a forgotten #pragma once
Emmanuele Bassi [Sat, 10 Oct 2020 12:23:21 +0000 (13:23 +0100)]
a11y: Convenience API for referencing ATSPI root node
We turn the root node into a reference fairly often, so it's worth it to
have a utility function that does this for us.
Emmanuele Bassi [Sat, 10 Oct 2020 11:51:03 +0000 (12:51 +0100)]
a11y: Add utility function for null refs
ATSPI was written for CORBA, which allows passing around "nil"
as valid object references.
Matthias Clasen [Sat, 10 Oct 2020 02:00:48 +0000 (22:00 -0400)]
atspicontext: Implement GetState
Translate the aria states to at-spi's interpretation
of atk states.
Matthias Clasen [Sat, 10 Oct 2020 01:59:57 +0000 (21:59 -0400)]
atspiroot: Fix GetState implementation
When the GetState signature says 'au', it actually
means a bitset that is sent as a pair of 32bit integers.
Matthias Clasen [Sat, 10 Oct 2020 00:25:38 +0000 (20:25 -0400)]
atspiroot: Implement GetIndexInParent
Just for good measure
Matthias Clasen [Sat, 10 Oct 2020 00:24:52 +0000 (20:24 -0400)]
atspicontext: Implement GetIndexInParent
This is needed for ATs to take our tree seriously.
Matthias Clasen [Fri, 9 Oct 2020 23:20:24 +0000 (19:20 -0400)]
atspicontext: Implement more accessible api
Implement GetChildAtIndex, GetChildren and ChildCount.
Matthias Clasen [Fri, 9 Oct 2020 22:33:28 +0000 (18:33 -0400)]
atspiroot: Implement GetChildren
No surprises here.
Matthias Clasen [Fri, 9 Oct 2020 22:21:15 +0000 (18:21 -0400)]
atspiroot: Don't leak references
The reffing getter trap, lurking behind g_list_model_get_item().
Matthias Clasen [Fri, 9 Oct 2020 19:16:43 +0000 (15:16 -0400)]
atspiroot: Implement GetLocale
Matthias Clasen [Fri, 9 Oct 2020 19:15:45 +0000 (15:15 -0400)]
atspicontext: Print out the a11y bus address
Make our debug spew useful: Having the bus address
makes it easy to jump on the a11y bus to look around
with dbus tools.
Emmanuele Bassi [Sat, 10 Oct 2020 11:55:54 +0000 (12:55 +0100)]
a11y: Localise the role name of the root node
Emmanuele Bassi [Fri, 9 Oct 2020 21:46:15 +0000 (22:46 +0100)]
a11y: Register the Accessible interface on all AtSpiContext instances
This is not a complement implementation.
Emmanuele Bassi [Fri, 9 Oct 2020 21:45:49 +0000 (22:45 +0100)]
a11y: Implement more ATSPI methods on the root node
Emmanuele Bassi [Fri, 9 Oct 2020 21:38:08 +0000 (22:38 +0100)]
a11y: Add method to extract desktop data
We are going to need the desktop name and path to populate the parent
property of AtSpiContexts associated to top level widgets.
Emmanuele Bassi [Fri, 9 Oct 2020 21:33:51 +0000 (22:33 +0100)]
a11y: Validate the DBus context path
UUIDs use dashes to separate the various blocks; unfortunately, this
results in an invalid DBus object path. Replace the dashes with an
underscore.
Emmanuele Bassi [Fri, 9 Oct 2020 21:31:58 +0000 (22:31 +0100)]
a11y: Turn accessible roles to string
Add a simple utility function to turn GtkAccessibleRole values into the
appropriate string, including localization.
Emmanuele Bassi [Fri, 9 Oct 2020 21:01:00 +0000 (22:01 +0100)]
a11y: Convert GTK roles to ATSPI ones
There's not a precise, 1:1 mapping between the newer ARIA roles and the
older ATSPI ones. We make do with what we have.
Emmanuele Bassi [Fri, 9 Oct 2020 20:23:19 +0000 (21:23 +0100)]
a11y: Compute the label for a GtkATContext
The ARIA spec defines the mechanism for determining the name of an
accessible element—see §4.3 of the WAI-ARIA spec.
We follow the specification as much as it makes sense for GTK to do
so:
1. if the element is hidden, return an empty string
1. if the element has a labelled-by relation set, retrieve the
label of the related element
2. if the element has a label property set, use the value of
the property
3. if neither labelled-by nor label attributes are set, we use
the role to compute the name:
- for a `range` role, we return the contents of the value of
the `value-text` or `value-now` properties
- for any other role, we return a textual representation of
the GtkAccessibleRole enumeration value
Emmanuele Bassi [Fri, 9 Oct 2020 17:17:04 +0000 (18:17 +0100)]
tests: Use the test ATContext for every test
Otherwise we're going to need a full desktop session in order to run the
test suite.
Emmanuele Bassi [Fri, 9 Oct 2020 13:49:10 +0000 (14:49 +0100)]
a11y: Return the ATSPI role for the root element
Emmanuele Bassi [Fri, 9 Oct 2020 13:20:43 +0000 (14:20 +0100)]
a11y: Add AT-SPI cache object
Right now, the cache is unused, and we still need to implement the
serialisation method and emit the signals.
Emmanuele Bassi [Fri, 9 Oct 2020 11:33:50 +0000 (12:33 +0100)]
a11y: Ignore widgets during destruction
There's no point in creating a GtkATContext when a widget is getting
destroyed.
Emmanuele Bassi [Fri, 9 Oct 2020 11:32:09 +0000 (12:32 +0100)]
a11y: Register the accessible root object
When we create the first AT-SPI context we also need to register the
accessible root on the accessibility bus. The accessible root object is
the main entry point of an accessible application, and it holds the
global state to present to the ATs that connect to the bus.
Emmanuele Bassi [Tue, 29 Sep 2020 17:40:44 +0000 (18:40 +0100)]
a11y: Add a display to GtkATContext
Since we need to check at run time what kind of AT context to use, we
need a hook into the whole GDK backend machinery. The display connection
seems to be the best choice, in this case, as it allows us to determine
whether we're running on an X11 or Wayland system, and thus whether we
should create a GtkAtSpiContext.
This requires some surgery to fix the GtkATContext creation function, in
order to include a GdkDisplay instance.
Emmanuele Bassi [Tue, 29 Sep 2020 17:18:36 +0000 (18:18 +0100)]
a11y: Add dummy AT-SPI context
Does not do anything, at the moment, but it's going to get filled out
soon.
The backend is selected depending on the platform being compiled in;
since we're using AT-SPI on X11 and Wayland, and we don't have other
accessibility implementations, we currently don't care about run time
selection, but we're going to have to deal with that.
Emmanuele Bassi [Tue, 29 Sep 2020 16:55:01 +0000 (17:55 +0100)]
a11y: Add the AT-SPI DBus descriptions
And generate the code for the DBus interfaces.
We don't want the full object manager experience, here, because we're
going to have a single object responding to various interfaces and
remote method calls. For this reason, we're not using the gnome module
in Meson to call gdbus-codegen for us: we need to use the interface info
command line arguments, and those are not available from Meson.
Emmanuele Bassi [Sat, 10 Oct 2020 00:44:31 +0000 (01:44 +0100)]
Use test AT context with installed tests
Otherwise we're going to need an AT-SPI service on the session, and the
accessibility bus.
Matthias Clasen [Mon, 12 Oct 2020 14:39:39 +0000 (14:39 +0000)]
Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master
See merge request GNOME/gtk!2683
Emmanuele Bassi [Mon, 12 Oct 2020 13:05:52 +0000 (14:05 +0100)]
Generate introspection for GdkWayland API
Like we do for GdkX11. We can't use all of the public C API, but we can
expose enough type information to allow non-C developers to actually
check if they are running the Wayland GDK backend or not—plus some
additional Wayland-specific API.
Emmanuele Bassi [Mon, 12 Oct 2020 13:04:13 +0000 (14:04 +0100)]
Add type annotations for GdkWayland API
The GdkWayland API takes generic GDK types and performs a run time
check, which means we need to properly annotate the actual expected
type in order to have methods recognised as such.
Emmanuele Bassi [Mon, 12 Oct 2020 13:02:54 +0000 (14:02 +0100)]
Skip GdkWayland symbols that use wayland-client types
The wayland-client API does not have introspection annotations, so we
can't use these types anyway.
Aurimas Černius [Sun, 11 Oct 2020 14:25:23 +0000 (17:25 +0300)]
Updated Lithuanian translation
Matthias Clasen [Sat, 10 Oct 2020 11:55:01 +0000 (11:55 +0000)]
Merge branch 'wip/chergert/gdk-macos-fixes' into 'master'
various build fixes for GDK/GTK on macos
See merge request GNOME/gtk!2680
Piotr Drąg [Sat, 10 Oct 2020 10:45:14 +0000 (12:45 +0200)]
Update Polish translation
Marek Černocký [Sat, 10 Oct 2020 10:17:27 +0000 (12:17 +0200)]
Updated Czech translation
Christian Hergert [Sat, 10 Oct 2020 03:08:23 +0000 (20:08 -0700)]
macos: port gtk to GDK_WINDOWING_MACOS
For the various uses of GDK_WINDOWING_QUARTZ, we need to use
alternatives from GDK_WINDOWING_MACOS.
Some minor loss of functionality is here, such as icons sent with
application menus. That can certainly be added back at a future
point.
Christian Hergert [Sat, 10 Oct 2020 03:05:20 +0000 (20:05 -0700)]
gtk: use GDK_WINDOWING_MACOS in gentypefuncs.py
Christian Hergert [Sat, 10 Oct 2020 03:04:27 +0000 (20:04 -0700)]
gdk: remove quartz subdirectory from backends
Christian Hergert [Sat, 10 Oct 2020 03:03:52 +0000 (20:03 -0700)]
macos: add key equivalent helper
This is needed by quartz code in gtk/.
Christian Hergert [Sat, 10 Oct 2020 03:02:38 +0000 (20:02 -0700)]
macos: remove workaround for scroll delta
This gets handled differently in gtk/ and so we shouldn't translate it here.
Christian Hergert [Sat, 10 Oct 2020 03:02:18 +0000 (20:02 -0700)]
macos: track various changes in GDK
Christian Hergert [Sat, 10 Oct 2020 02:58:07 +0000 (19:58 -0700)]
macos: lookup NSEvent by translated GdkEvent
This will be needed by the quartz imcontext.
Christian Hergert [Sat, 10 Oct 2020 02:56:21 +0000 (19:56 -0700)]
macos: move input method names to private header